import request from "../../../utils/request"
import {getToken} from "../../../utils/auth";

/**
 * 分页查询所有文件
 * @param obj
 * @returns {AxiosPromise}
 */
export function  findAllfile(obj){
    return request({
        url:`/admin/demo-file/page`,
        method:'post',
        data: JSON.stringify(obj),

    })
}

/**
 * 文件预览
 * @param fileName
 * @returns {AxiosPromise}
 */
export function  previewFile(fileName){
    return request({
        url:`/admin/demo-file/previewFile?fileName=`+fileName,
        method:'get',
    })
}
/**
 * 删除文件
 * @param id
 * @returns {AxiosPromise}
 */
export function deleteFile(id) {
    return request({
        url: `/admin/demo-file/delete/` + id,
        method: 'post'
    })
}

/**
 * 上传头像
 * @param file
 * @returns {AxiosPromise}
 */
export function uploadFace(file) {
    return request({
        url: `/admin/demo-file/uploadFace`,
        method: 'post',
        headers:{
            "Content-Type": "multipart/form-data"
        },
        data:file
    })
}
